package View.CaixaView;

import java.awt.Dimension;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.LayoutStyle.ComponentPlacement;

import Controller.CaixaController.CaixaController;
import Entidade.Caixa;
import framework.component.field.TTextField;
import framework.mvc.GenericView;
import javax.swing.SwingConstants;
import java.awt.Component;

public class CaixaView extends GenericView<Caixa> {

	private static final long serialVersionUID = -8857415586961585118L;
	private JLabel label;
	private TTextField textField;
	private JLabel lblStatusCaixa;
	private TTextField textField_1;
	private JLabel lblTipo;
	private TTextField textField_2;
	private JButton button;
	private JButton button_1;
	private JLabel lblCdigo;
	private TTextField textField_3;

	public CaixaView() {
		super(new CaixaController());
		setResizable(false);
		setTitle("Fox Empresarial - Cadastro de Caixas");
		setSize(new Dimension(450, 193));

		label = new JLabel("Nome:");

		textField = new TTextField();
		textField.setName("NomeCaixa");
		textField.setColumns(10);

		lblStatusCaixa = new JLabel("Status ");

		textField_1 = new TTextField();
		textField_1.setName("StatusCaixa");
		textField_1.setColumns(10);

		lblTipo = new JLabel("Tipo:");

		textField_2 = new TTextField();
		textField_2.setName("TipoCaixa");
		textField_2.setColumns(10);

		button = new JButton("Salvar");
		button.setName("salvar");

		button_1 = new JButton("Cancelar");
		button_1.setName("cancelar");
		
		lblCdigo = new JLabel("C\u00F3digo:");
		
		textField_3 = new TTextField();
		textField_3.setEditable(false);
		textField_3.setName("IdCaixa");
		textField_3.setColumns(10);
		GroupLayout groupLayout = new GroupLayout(getContentPane());
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
						.addGroup(groupLayout.createSequentialGroup()
							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
								.addComponent(lblCdigo, GroupLayout.DEFAULT_SIZE, 52, Short.MAX_VALUE)
								.addComponent(label, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE)
								.addComponent(lblStatusCaixa, GroupLayout.DEFAULT_SIZE, 52, Short.MAX_VALUE)
								.addComponent(lblTipo, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE))
							.addGap(28)
							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
								.addComponent(textField, GroupLayout.PREFERRED_SIZE, 324, GroupLayout.PREFERRED_SIZE)
								.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, 324, GroupLayout.PREFERRED_SIZE)
								.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, 324, GroupLayout.PREFERRED_SIZE)
								.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
						.addGroup(groupLayout.createSequentialGroup()
							.addComponent(button, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
							.addGap(8)
							.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
							.addGap(33))))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(15)
							.addComponent(lblCdigo)
							.addPreferredGap(ComponentPlacement.RELATED))
						.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
							.addContainerGap(15, Short.MAX_VALUE)
							.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED)))
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(label)
						.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(9)
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(lblStatusCaixa)
						.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(11)
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(lblTipo)
						.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(button)
						.addComponent(button_1))
					.addContainerGap())
		);
		groupLayout.linkSize(SwingConstants.HORIZONTAL, new Component[] {label, lblStatusCaixa, lblTipo, lblCdigo});
		getContentPane().setLayout(groupLayout);
	}
}
